<%@ page isELIgnored="false" %>
<%@ page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>EM Live Ranking - Edit</title>
</head>
<body>
Neues Team:<br/><br/>
<form:form action="saveteam.html" commandName="team">
    Name:<FONT color="red"><form:errors path="name"/></FONT><form:input path="name" size="75"/>
    <input type="submit" value="Speichern"/>
</form:form>
<hr/>
Alle Teams:
<table>

    <c:forEach items="${teams.teams}" varStatus="idx">
        <tr>
            <td>
                <form:form action="updateteam.html" commandName="team[${idx.index}]">
                    <form:hidden path="id"/>
                    <form:hidden path="countryImageId"/>
                    Name:<form:input path="name" size="55"/>
                    <input type="submit" value="Aktualisieren"/>
                </form:form></td>
            <td><img src="showImage.html?id=${teams.teams[idx.index].countryImageId}&dimension=25" height="25px"/></td>
            <td>
                <form method="post" action="uploadcountry.html?id=${teams.teams[idx.index].id}"
                      enctype="multipart/form-data">
                    <input type="text" name="id" value="${teams.teams[idx.index].id}"/>
                    <input type="file" name="file"/>
                    <input type="submit"/>
                </form>
            </td>
            <td><form:form action="deleteteam.html?id=${teams.teams[idx.index].id}" commandName="teams">
                <form:hidden path="teams[${idx.index}].id"/>
                <input type="submit" value="Löschen"/>
            </form:form></td>
        </tr>
    </c:forEach>
</table>
<%--<c:forEach items="${players}" var="player">--%>
<%--<form action="update.html" method="post">--%>
<%--<input type="text" value="${player.name}" name="name"/><input type="submit" value="Update"/>--%>
<%--<c:out value="${player.name}"/> - <c:out value="${player.score}"/></br>--%>
<%--</form>--%>
<%--</c:forEach>--%>
</body>
</html>